﻿<Window x:Class="Adan.Client.Map.Dialogs.RoomEditDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:Properties="clr-namespace:Adan.Client.Map.Properties"
        xmlns:Controls="clr-namespace:Adan.Client.Common.Controls;assembly=Adan.Client.Common"
        mc:Ignorable="d"
        Width="530"
        MaxHeight="700"
        Style="{StaticResource DefaultWindowStyle}"
        Title="{x:Static Properties:Resources.RoomEditor}"
        ResizeMode="NoResize"
        ShowInTaskbar="False"
        WindowStartupLocation="CenterOwner"
        WindowStyle="ToolWindow"
        SizeToContent="Height">
    <Window.Resources>
        <ResourceDictionary Source="..\Resources.xaml"
                            x:Key="MapResources" />
    </Window.Resources>
    <StackPanel>
        <TextBlock Text="{Binding Path=Name}"
                   Foreground="{DynamicResource TextBrush}"
                   FontSize="16"
                   TextTrimming="CharacterEllipsis"
                   Margin="5,0,0,0"
                   VerticalAlignment="Center"
                   FontWeight="SemiBold" />
        <TextBlock Foreground="{DynamicResource TextBrush}"
                   FontSize="12"
                   Margin="15,5,5,0"
                   TextWrapping="Wrap"
                   Text="{Binding Path=Description}"
                   TextAlignment="Justify"
                   IsHyphenationEnabled="True"
                   MaxHeight="200" />
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition  Width="auto" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock Text="{x:Static Properties:Resources.RoomAlias}"
                       Foreground="{DynamicResource TextBrush}"
                       FontSize="14"
                       TextTrimming="CharacterEllipsis"
                       Margin="5,5,0,0"
                       Grid.Row="0"
                       Grid.Column="0" />
            <TextBox Grid.Row="0"
                     Grid.Column="1"
                     Margin="5,5,0,0"
                     HorizontalAlignment="Left"
                     Width="150"
                     Text="{Binding Path=Alias}" />

            <TextBlock Text="{x:Static Properties:Resources.RoomIcon}"
                       Foreground="{DynamicResource TextBrush}"
                       FontSize="14"
                       TextTrimming="CharacterEllipsis"
                       VerticalAlignment="Center"
                       Margin="5,5,0,0"
                       Grid.Row="1"
                       Grid.Column="0" />
            <ComboBox Grid.Row="1"
                      Grid.Column="1"
                      Margin="5,5,0,0"
                      HorizontalAlignment="Left"
                      ItemsSource="{StaticResource IconsList}"
                      SelectedValue="{Binding Path=Icon, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <Border Width="50">
                            <Border Width="25"
                                    Height="25"
                                    CornerRadius="2"
                                    BorderBrush="White"
                                    BorderThickness="2"
                                    HorizontalAlignment="Center"
                                    Background="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.Color,Converter={StaticResource RoomColorToBrushConverter}}">
                                <Border Background="{Binding Converter={StaticResource RoomIconToBrushConverter}}" />
                            </Border>
                        </Border>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <TextBlock Text="{x:Static Properties:Resources.RoomColor}"
                       Foreground="{DynamicResource TextBrush}"
                       FontSize="14"
                       TextTrimming="CharacterEllipsis"
                       Margin="5,5,0,0"
                       VerticalAlignment="Center"
                       Grid.Row="2"
                       Grid.Column="0" />
            <ComboBox Grid.Row="2"
                      Grid.Column="1"
                      Margin="5,5,0,0"
                      HorizontalAlignment="Left"
                      ItemsSource="{StaticResource ColorsList}"
                      SelectedValue="{Binding Path=Color, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <Border Width="50">
                            <Border Width="25"
                                    Height="25"
                                    CornerRadius="2"
                                    BorderBrush="White"
                                    BorderThickness="2"
                                    HorizontalAlignment="Center"
                                    Background="{Binding Converter={StaticResource RoomColorToBrushConverter}}">
                            </Border>
                        </Border>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>

            <TextBlock Text="{x:Static Properties:Resources.RoomComments}"
                       Foreground="{DynamicResource TextBrush}"
                       FontSize="14"
                       TextTrimming="CharacterEllipsis"
                       Margin="5,5,0,0"
                       Grid.Row="3"
                       Grid.Column="0" />
            <TextBox   HorizontalAlignment="Stretch"
                       AcceptsReturn="True"
                       TextWrapping="Wrap"
                       VerticalScrollBarVisibility="Visible"
                       Text="{Binding Comments}"
                       Height="66"
                       Margin="5,5,5,0"
                       Grid.Row="3"
                       Grid.Column="1" />
        </Grid>

        <Grid Margin="5,10,5,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <StackPanel Orientation="Horizontal"
                        Grid.Column="0">
                <TextBlock TextTrimming="WordEllipsis"
                           Foreground="{DynamicResource TextBrush}"
                           FontSize="14"
                           Text="{x:Static Properties:Resources.RoomActions}" />
                <TextBlock Margin="5,0,0,0"
                           Foreground="{DynamicResource TextBrush}"
                           FontSize="14"
                           Text="{Binding Path=ActionsViewModel.ActionsDescription}" />
            </StackPanel>

            <ComboBox Grid.Column="1"
                      Width="150"
                      SelectedValue="{Binding Path=ActionsViewModel.SelectedActionDescriptor}"
                      ItemsSource="{Binding Path=ActionsViewModel.ActionDescriptions}"
                      DisplayMemberPath="DisplayName"
                      Visibility="{Binding Path=ActionsViewModel.ActionsCollectionEmpty, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneWay}" />
            <Button Grid.Column="2"
                    Width="18"
                    Height="18"
                    HorizontalAlignment="Right"
                    Margin="5,0,0,0"
                    Command="{Binding Path=ActionsViewModel.AddFirstActionCommand}"
                    Visibility="{Binding Path=ActionsViewModel.ActionsCollectionEmpty, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneWay}">
                <ContentControl Style="{StaticResource AddItemIcon}"
                                Width="10"
                                Height="10" />
            </Button>
        </Grid>

        <ScrollViewer CanContentScroll="False"
                      Margin="5,5,0,0"
                      MinHeight="100"
                      MaxHeight="200">
            <Controls:ActionEditorControl DataContext="{Binding Path=ActionsViewModel}"
                                          VerticalAlignment="Top"
                                          HorizontalAlignment="Stretch"
                                          Grid.Row="1"
                                          Grid.ColumnSpan="3"
                                          Grid.Column="0" />
        </ScrollViewer>

        <StackPanel Orientation="Horizontal"
                    HorizontalAlignment="Right"
                    Margin="5">
            <Button IsDefault="True"
                    MinWidth="50"
                    Click="HandleOkClicked"
                    Content="{x:Static Properties:Resources.Ok}" />
            <Button IsCancel="True"
                    Margin="5,0,0,0"
                    MinWidth="50"
                    Content="{x:Static Properties:Resources.Cancel}" />
        </StackPanel>
    </StackPanel>
</Window>